



/**----------------------------------------------------------
			拖拽 电脑端
-------------------------------------------------------------
 * */
var mDoms = [];
var mCurr = null;
// onmousedown="javascirpt:hMouseDown(event);"
function hMouseDown(e) {
	mCurr = e.currentTarget;
	var id = mCurr.id;
	if (!id) {
		id = Date.now() + "_autoid";
		mCurr.id = id;
		return;
	}
	if (!mDoms[id]) {
		mDoms[id] = {
			dom: mCurr,
			xy: {
				x: 0,
				y: 0
			}
		}
	}
	if (mCurr) {
		document.addEventListener("mousemove", hMove);
		document.addEventListener("mouseup", hMouseUp);
	}
}

function hMouseUp(e) {
	document.removeEventListener("mouseup", hMouseUp);
	document.removeEventListener("mousemove", hMove);
}

function hMove(e) {
	var odom = mDoms[mCurr.id];
	if (!odom) {
		return;
	}
	var dom = odom.dom;
	if (!dom) {
		hMouseUp();
		return;
	}
	var xy = odom.xy;
	xy.x += e.movementX;
	xy.y += e.movementY;
	dom.style.transform = `translate(${xy.x}px,${xy.y}px)`;
}



